package Dictlino::View;
use Jifty::View::Declare -base;
use Dictlino::Action::Query;

template '/' => page {
    { title is _ "Dictlino" }

    my $act = Jifty->web->new_action(
        class => "Query",
        sticky_on_success => 1,
        sticky_on_failure => 1,
    );
    Jifty->web->form->start;

    outs_raw $act->form_field("d");
    outs_raw $act->form_field("q");
    Jifty->web->form->submit(label => "Lookup");
    Jifty->web->form->end;

    if ( my $defs = $act->result->content('definition') ) {
        for my $def (@$defs) {
            dl {
                for my $k ( keys %$def ) {
                    dt { _($k) };
                    dd {
                        $def->{$k};
                    }
                }
            }
        }
    }

};


1;
